// SSH连接相关类型定义

export interface SshConnection {
  id: string;
  config: SshConfig;
  status: ConnectionStatus;
  created_at: string;
  connected_at?: string;
  last_activity?: string;
  error_message?: string;
}

export interface SshConfig {
  host: string;
  port: number;
  username: string;
  auth_method: AuthMethod;
  password?: string;
  private_key_path?: string;
  private_key_passphrase?: string;
  use_agent: boolean;
  connect_timeout: number;
  keepalive_interval: number;
  compression: boolean;
  proxy_jump?: string;
}

export interface AuthMethod {
  type: 'password' | 'public_key' | 'agent' | 'interactive';
  data?: Record<string, any>;
}

export interface ConnectionStatus {
  status: 'disconnected' | 'connecting' | 'connected' | 'error';
  message?: string;
}

// 终端相关类型定义
export interface Terminal {
  id: string;
  connection_id: string;
  title: string;
  status: TerminalStatus;
  size: TerminalSize;
  created_at: string;
  last_activity?: string;
}

export interface TerminalStatus {
  status: 'inactive' | 'active' | 'error';
  message?: string;
}

export interface TerminalSize {
  cols: number;
  rows: number;
}

export interface TerminalEvent {
  type: 'data' | 'resize' | 'close' | 'error';
  terminal_id: string;
  data?: any;
  timestamp: string;
}

// 隧道相关类型定义
export interface Tunnel {
  id: string;
  connection_id: string;
  name: string;
  config: TunnelConfig;
  status: TunnelStatus;
  description?: string;
  created_at: string;
  started_at?: string;
  bytes_sent?: number;
  bytes_received?: number;
}

export interface TunnelConfig {
  tunnel_type: TunnelType;
  local_host: string;
  local_port: number;
  remote_host: string;
  remote_port: number;
}

export type TunnelType = 'local' | 'remote' | 'dynamic';

export interface TunnelStatus {
  status: 'stopped' | 'starting' | 'running' | 'active' | 'stopping' | 'error';
  message?: string;
  error?: string;
}

// API响应类型
export interface ApiResponse<T = any> {
  success: boolean;
  data?: T;
  error?: string;
}

// 事件类型
export interface AppEvent {
  type: string;
  payload?: any;
  timestamp: string;
}